package com.frinder.seata.storage.web;

import com.frinder.seata.data.base.Result;
import com.frinder.seata.storage.service.BizStorageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName BizStorageController
 * @Description 扣减库存服务
 * @Author frinder
 * @Date 2020/8/18 15:36
 * @Verion 1.0
 */
@RestController
@RequestMapping("/biz/storage")
public class BizStorageController {

    @Resource
    private BizStorageService bizStorageService;

    @ApiOperation("扣减库存服务")
    @PostMapping("/decrease")
    public Result decrease(@RequestParam long productId, @RequestParam int qty) {
        bizStorageService.decrease(productId, qty);
        return Result.defSuccess();
    }

}
